package com.midou.administration.service.impl;

import com.midou.administration.entity.UserCoupon;
import com.midou.administration.mapper.UserCouponMapper;
import com.midou.administration.service.UserCouponService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author MrChen
 * @since 2021-03-24
 */
@Service
public class UserCouponServiceImpl implements UserCouponService {

    @Autowired
    private UserCouponMapper userCouponMapper;

    /*向卡包表添加一条新的数据*/
    @Override
    public Integer createNew(UserCoupon userCoupon) {
        return this.userCouponMapper.insert(userCoupon);
    }

    /**
     * 根据用户卡包表的id  查询该优惠信息
     * @param id 主键
     * @return  卡包信息
     */
    @Override
    public UserCoupon queryByid(Integer id) {

        return this.userCouponMapper.sele(id);
    }

    @Override
    public List<UserCoupon> queryByyserId(int id) {

        return this.userCouponMapper.queryByUserId(id);
    }
}
